#打印一次指定数字的乘法表
print("打印一次指定数字的乘法表")
mutiplier=5
for i in range(1,11):
    print("%d x %d = %d"%(i,mutiplier,i*mutiplier))
print()

#一次打印三个指定数字的乘法表
print("一次打印三个指定数字的乘法表")
for mutiplier in range(5,8):
    for i in range(1,11):
        print("%d x %d = %d"%(i,mutiplier,i*mutiplier))
    print()
print()

#显示用户输入的星号
curInputNumber=input("1-你想要多少颗星号？")
if(curInputNumber!=''):
    starsNumber=int(curInputNumber)
    for i in range(1,starsNumber+1):
        print("*")
print()

curInputNumber=input("2-你想要多少颗星号？")
if(curInputNumber!=''):
    starsNumber=int(curInputNumber)
    print(starsNumber*"*")
print()

#用户可控制显示多少行每行显示多少颗星星
print("用户可以控制显示多少行,每行显示多少颗星星")
inputRowNum=input("请输入你想要显示的多少行星星的数量：")
inputPerRowShowStarts=input("请输入每行显示的星星数量：")
if(inputRowNum!='' and inputPerRowShowStarts!=''):
    curInputRowNum=int(inputRowNum)
    curInputPerRowNumStarts=int(inputPerRowShowStarts)
    for row in range(0,curInputRowNum):
        for start in range(0,curInputPerRowNumStarts):
            print('*',end='')
        print()
print()

#利用双重嵌套循环生成星号块
numBlocks=int(input('你想要多少块星星？'))
numLines=int(input('每块显示多少行星星？'))
numStarts=int(input('每行显示多少颗星星？'))

for block in range(0,numBlocks):
    for line in range(0,numLines):
        for star in range(0,numStarts):
            print('*',end='')
        print()
    print()

#更复杂的星号块
print("更复杂的星号块")
numBlocks=int(input("你想要显示多少块的星星？"))
for block in range(1,numBlocks+1):
    for line in range(1,block*2):
        for star in range(1,(block+line)*2):
            print('*',end='')
        print()
    print()
print()

print("更复杂的星号块解析")
numBlocks=int(input("你想要显示多少块的星星？"))
for block in range(1,numBlocks+1):
    print('块 %d'%block)
    for line in range(1,block*2):
        for star in range(1,(block+line)*2):
            print('*',end='')
        print(' 行 %d 星星数为 %d'%(line,star))
    print()
print()

print("\n热狗组合")
print('\tDog    \tBun   \tKetchup   \tMustard   \tOnions')
selectd=[0,1]
count=1
for dog in selectd: #热狗循环
    for bun in selectd: #小面包循环
        for ketchup in selectd: #番茄酱循环
            for mustard in selectd: #芥末酱循环
                for onion in selectd:   #洋葱循环
                    print("#",count,'\t',end='')
                    print(dog,'\t',bun,'\t',ketchup,'\t\t',end='')
                    print(mustard,'\t\t',onion)
                    count=count+1


print("\n热狗组合[增加卡路里]")
print('\tDog    \tBun   \tKetchup   \tMustard   \tOnions    \tCalories')
selectd=[0,1]
dog_cal=140
bun_cal=120
ket_cal=80
mus_cal=20
onion_cal=40

count=1
for dog in selectd: #热狗循环
    for bun in selectd: #小面包循环
        for ketchup in selectd: #番茄酱循环
            for mustard in selectd: #芥末酱循环
                for onion in selectd:   #洋葱循环
                    total_cal=(dog*dog_cal)+(bun*bun_cal)+(ketchup*ket_cal)+(mustard*mus_cal)+(onion*onion_cal)
                    print("#",count,'\t',end='')
                    print(dog,'\t',bun,'\t',ketchup,'\t\t',end='')
                    print(mustard,'\t\t',onion,'\t\t',total_cal)
                    count=count+1